import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router'
console.log(window.location.port, '----------')
// 智能问数路由
let zhinengwenshuRoute = {
	path: '/',
	component: () => import('@/pages/demos/chat/index.vue'),
}
// 文档审核
let word = {
	path: '/',
	component: () => import('@/pages/pengwei/index.vue'),
	redirect: '/word/analyze-word',
	children: [
		{
			path: '/word/analyze-word',
			name: 'PengweiAnalyzeWord',
			component: () => import('@/pages/pengwei/analyze-word/index.vue'),
		},
		// {
		// 	path: 'preview-xlsx',
		// 	name: 'PengweiPreviewXlsx',
		// 	component: () => import('@/pages/pengwei/preview-xlsx/index.vue'),
		// },
	],
}
// 定义路由
const routes: RouteRecordRaw[] = [
	// 水务
	{
		path: '/longgang',
		component: () => import('@/pages/longgang/index.vue'),
		redirect: '/longgang/chat',
		children: [
			{
				path: 'chat',
				name: 'LonggangChat',
				component: () => import('@/pages/longgang/chat/index.vue'),
			},
		],
	},
	// 404
	{
		path: '/:pathMatch(.*)*',
		name: 'NotFound',
		component: () => import('@/pages/error/not-found/index.vue'),
	},
]

/*
30083  问数
30084 文档审核
30085 备份
*/
let prot = location.port
if (import.meta.env.VITE_CURRENT_MODE === 'development') {
	prot = '30083'
}
// let prot = '30083'
if (prot === '30083') {
	routes.unshift(zhinengwenshuRoute)
} else if (prot === '30084') {
	routes.unshift(word)
}

console.log(routes, '路由')

// 创建路由实例
const router = createRouter({
	history: createWebHistory(),
	routes,
})

export default router
